#include "BlackBearFactoryTest.h"

#include <QtTest/QtTest>
#include <QSqlDatabase>
#include <QDir>

#include "TestSuite.h"
#include "BlackBear.h"
#include "BlackBearFactory.h"

void BlackBearFactoryTest::instance()
{
	BlackBearFactory* blackBearFactory = BlackBearFactory::instance();
	
	QVERIFY( blackBearFactory != NULL );
}

void BlackBearFactoryTest::instanceTwoTimes()
{
	BlackBearFactory* blackBearFactoryFirst = BlackBearFactory::instance();
	BlackBearFactory* blackBearFactorySecond = BlackBearFactory::instance();

	QCOMPARE( blackBearFactoryFirst, blackBearFactorySecond );
}

void BlackBearFactoryTest::connect()
{
	BlackBearFactory* blackBearFactory = BlackBearFactory::instance();
	
	BlackBear* bb = blackBearFactory->connect( "DataBaseTest1", "UserTest", "1234", "HostTest" );

	QVERIFY( bb != NULL );

	delete bb;
}

void BlackBearFactoryTest::connectWithDefinedPath()
{
	BlackBearFactory* blackBearFactory = BlackBearFactory::instance();

	BlackBear* bb = blackBearFactory->connect( QDir::currentPath() + "\\DataBaseTest2.db", "UserTest", "1234", "HostTest" );

	QVERIFY( bb != NULL );

	delete bb;
}

REGISTER_TEST_CLASS( BlackBearFactoryTest );
